package psn.zjk.common.utils;

import java.lang.instrument.Instrumentation;

/**
 * @Description
 * @User zero
 * @Datetime 2021/5/23 10:03
 */
public class ClassMemoryView {
    static  Instrumentation inst;


    public static void main(String[] args) {
//java -javaagent:ClassMemoryView -XX:-UseCompressedOops ClassMemoryView
        sizeOf(new Object());
    }

    public static void premain(String args, Instrumentation instP) {
        inst = instP;
    }

    public static long sizeOf(Object obj) {
        return inst.getObjectSize(obj);
    }

}
